﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Account/Site.master" AutoEventWireup="true" CodeFile="TinTuc.aspx.cs" Inherits="Administrator_TinTuc" %>

<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" 
        Font-Size="0.8em" PathSeparator=" : " style="font-size: small">
        <CurrentNodeStyle ForeColor="#333333" />
        <NodeStyle Font-Bold="True" ForeColor="#284E98" />
        <PathSeparatorStyle Font-Bold="True" ForeColor="#507CD1" />
        <RootNodeStyle Font-Bold="True" ForeColor="#507CD1" />
    </asp:SiteMapPath>
            <br />
    <asp:Label ID="Label1" runat="server" 
        style="font-size: x-large; font-weight: 700" Text="Quản lý tin tức"></asp:Label>
            <br />
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:tantinhn_dietmoitmConnectionString %>" 
                
        SelectCommand="SELECT * FROM [TinTuc] WHERE ([LoaiTin] = @LoaiTin)" 
        DeleteCommand="DELETE FROM [TinTuc] WHERE [ID] = @ID" 
        InsertCommand="INSERT INTO [TinTuc] ([TieuDe], [NoiDung], [NgayDang], [NguoiDang], [HinhAnh], [GioiThieu], [LoaiTin]) VALUES (@TieuDe, @NoiDung, @NgayDang, @NguoiDang, @HinhAnh, @GioiThieu, @LoaiTin)" 
        UpdateCommand="UPDATE [TinTuc] SET [TieuDe] = @TieuDe, [NoiDung] = @NoiDung, [NgayDang] = @NgayDang, [NguoiDang] = @NguoiDang, [HinhAnh] = @HinhAnh, [GioiThieu] = @GioiThieu, [LoaiTin] = @LoaiTin WHERE [ID] = @ID">
                <DeleteParameters>
                    <asp:Parameter Name="ID" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="TieuDe" Type="String" />
                    <asp:Parameter Name="NoiDung" Type="String" />
                    <asp:Parameter Name="NgayDang" Type="DateTime" />
                    <asp:Parameter Name="NguoiDang" Type="String" />
                    <asp:Parameter Name="HinhAnh" Type="String" />
                    <asp:Parameter Name="GioiThieu" Type="String" />
                    <asp:Parameter Name="LoaiTin" Type="Int32" />
                </InsertParameters>
                <SelectParameters>
                    <asp:ControlParameter ControlID="ddlLoaiTin" Name="LoaiTin" 
                        PropertyName="SelectedValue" Type="Int32" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="TieuDe" Type="String" />
                    <asp:Parameter Name="NoiDung" Type="String" />
                    <asp:Parameter Name="NgayDang" Type="DateTime" />
                    <asp:Parameter Name="NguoiDang" Type="String" />
                    <asp:Parameter Name="HinhAnh" Type="String" />
                    <asp:Parameter Name="GioiThieu" Type="String" />
                    <asp:Parameter Name="LoaiTin" Type="Int32" />
                    <asp:Parameter Name="ID" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
            Thể loại tin :
    <asp:DropDownList ID="ddlTheLoai" runat="server" DataSourceID="SqlDataSource5" 
        DataTextField="TieuDe" DataValueField="ID" Width="300px" 
        AutoPostBack="True" 
        onselectedindexchanged="ddlTheLoai_SelectedIndexChanged">
        <asp:ListItem></asp:ListItem>
    </asp:DropDownList>
&nbsp;&nbsp;&nbsp; Loại Tin :
    <asp:DropDownList ID="ddlLoaiTin" runat="server" DataSourceID="SqlDataSource6" 
        DataTextField="TieuDe" DataValueField="ID" Width="300px">
        <asp:ListItem></asp:ListItem>
    </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
        ConnectionString="<%$ ConnectionStrings:tantinhn_dietmoitmConnectionString %>" 
        SelectCommand="SELECT * FROM [TheLoai]"></asp:SqlDataSource>
    <asp:Button ID="Button1" runat="server" Text="Tìm kiếm" />
    <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
        ConnectionString="<%$ ConnectionStrings:tantinhn_dietmoitmConnectionString %>" 
        SelectCommand="SELECT * FROM [LoaiTin] WHERE ([TheLoai] = @TheLoai)">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlTheLoai" Name="TheLoai" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
                DataSourceID="SqlDataSource1" EnableModelValidation="True" 
        Width="100%" CellPadding="3" BackColor="White" BorderColor="#CCCCCC" 
                BorderStyle="None" BorderWidth="1px">
                <Columns>
                    <asp:CommandField DeleteText="Xóa" ShowDeleteButton="True">
                    <ItemStyle Width="10px" />
                    </asp:CommandField>
                    <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                        ReadOnly="True" SortExpression="ID">
                    <ItemStyle Width="20px" />
                    </asp:BoundField>
                    <asp:HyperLinkField DataNavigateUrlFields="ID" 
                        DataNavigateUrlFormatString="ctTinTuc.aspx?ID={0}" DataTextField="TieuDe" 
                        HeaderText="Tiêu đề" SortExpression="TieuDe" />
                    <asp:BoundField DataField="NgayDang" HeaderText="Ngày đăng" 
                        SortExpression="NgayDang" />
                    <asp:BoundField DataField="NguoiDang" HeaderText="Người đăng" 
                        SortExpression="NguoiDang" />
                </Columns>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            <asp:LinkButton ID="LinkButton1" runat="server" 
        onclick="LinkButton1_Click">Tạo mới</asp:LinkButton>
    <br />
</asp:Content>

